package com.me.waterphase;

import java.util.Iterator;

import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.me.waterphase.listener.contact.ArtifactContact;
import com.me.waterphase.utils.PhysicManager;

public class WaterArtifact {

	private Body body;
	private float width;
	private float height;
	private float originalDensity;
	
	public WaterArtifact(float _x, float _y, float _width, float _height)
	{
		originalDensity = 100f;
		body = PhysicManager.createRectBody(BodyType.DynamicBody, _x, _y, 0, originalDensity, 0.5f, _width, _height,false, false, false, false);
		body.setSleepingAllowed(false);
		
		Fixture fix = null;
		for(Iterator<Fixture> it = body.getFixtureList().iterator(); it.hasNext();)
		{
			fix = it.next();
			if(fix.getUserData() == null)
				fix.setUserData(new ArtifactContact(this));
		}
	}
	
	//TODO.
	public void render(){
		
	}
	
	//Getter
	public Body getBody() {return body;}
	public ArtifactContact getArtifactContact(){ return (ArtifactContact) body.getFixtureList().get(0).getUserData(); }
	public float getWidth(){return width;}
	public float getHeight(){return height;}
	public float getOriginalDensity(){return originalDensity;}
}
